package project;

import java.util.List;

public class RandomPlayer extends Player {
	
	RandomPlayer(int playerNum) {
		super(playerNum);
		this.playerNum = playerNum;
	}
	
	@Override
	public Move getNextMove(GameState state) {
		List<Move> validMoves = state.validMoves();
		int numMoves = validMoves.size();
		int randomIndex = getRandomIndex(0, numMoves);
		return validMoves.get(randomIndex);
	}
	
	private int getRandomIndex(int minIndex, int maxIndex) {
		int randIndex = minIndex + (int)(Math.random()*maxIndex); 
		return randIndex;
	}

	@Override
	public boolean isHuman() {
		return false;
	}

}